<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">

    <div class="container-div">
		<div class="col-sm-12 search-collapse">
			<form id="type-form">
				<div class="select-list">
					<ul>
						<li>
							用户ID号：<input type="text" name="openid"/>
						</li>
						<li>
							手机号：<input type="text" name="mobile"/>
						</li>
						<li>
							<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
						</li>
					</ul>
				</div>
			</form>
		</div>
		<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
			<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="sj:wqEweiShopMember:add">
				<i class="fa fa-plus"></i> 添加
			</a>
			<!--<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="sj:wqEweiShopMember:edit">
	            <i class="fa fa-edit"></i> 修改
	        </a>-->
			<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="sj:wqEweiShopMember:remove">
				<i class="fa fa-remove"></i> 删除
			</a>
		</div>
			
		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table" data-mobile-responsive="true" style="table-layout:fixed"></table>
		</div>
    </div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('sj:wqEweiShopMember:edit')}]];
        var removeFlag = [[${@permission.hasPermi('sj:wqEweiShopMember:remove')}]];
        var datas = [[${@dict.getType('sj_sex')}]];
        var prefix = ctx + "sj/wqEweiShopMember";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                modalName: "用户",
                search: false,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'id', 
					title : '序号',
                    formatter:function(value, row , index){
                        return index+1;
                    }
				},
				{
					field : 'openid', 
					title : '用户ID号'
				},
                    {
                        field : 'username',
                        title : '用户名'
                    },
				{
					field : 'mobile', 
					title : '手机号'
				},
			/*	{
					field : 'pwd', 
					title : '密码' 
				},*/
				{
					field : 'content', 
					title : '签名',
					formatter:function (value,row,index) {
						return '<p title="'+value+'" style="width:100px;overflow: hidden;white-space: nowrap;text-overflow:ellipsis">'+value+'</p>'
                    }
                   /* cellStyle: {
                        css: {
                            "width":"50px",
                            "overflow": "hidden",
                            "text-overflow": "ellipsis",
                            "white-space": "nowrap"
                        }
                    }*/
                    },
				{
					field : 'birthyear', 
					title : '出生年'
				},
				{
					field : 'birthmonth', 
					title : '出生月'
				},
				{
					field : 'birthday', 
					title : '出生日'
				},
				{
					field : 'gender', 
					title : '性别',
                   formatter:function (value, row, index) {   //回显数据字典
					   return $.table.selectDictLabel(datas,value);
                   }

				},

				/*{
					field : 'province', 
					title : '省'
				},
				{
					field : 'city', 
					title : '市'
				},
				{
					field : 'area', 
					title : '区'
				},*/
                /*    {
                        field : 'inviter',
                        title : '邀请人'
                    },*/
                    {
                        field : 'isblack',
                        title : '黑名单',
						formatter:function (value, row, index) {
							return {
							    0:"否",
								1:"是"
							}[value]
                        }
                    },
                    {
                        field : 'avatar',
                        title : '头像',
                        formatter: function(value, row, index) {
                            return "<img width='100px' height='100px' src='"+value+"'/>";
                        }
                    },
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push(aaaaa(row))
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');


                        return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });

        function aaaaa(row) {
			if (row.isblack == 0) {
			    return '<a class="btn btn-danger btn-xs ' + editFlag + '" href="#" onclick="jiaru(\'' + row.id + '\')"><i class="fa fa-edit"></i>加入黑名单</a> ';
			}else {
			    return '<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="yichu(\'' + row.id + '\')"><i class="fa fa-edit"></i>移除黑名单</a> ';
			}
        }

		/*加入黑名单*/
     	function jiaru(id){
            var url ="/sj/wqEweiShopMember/changeStatusById";
            $.operate.submit(url, "post", "json", {id:id});
		}
		/*移除黑名单*/
		function yichu(id) {
			var url = "/sj/wqEweiShopMember/changeStatus";
			$.operate.submit(url,"post","json",{id:id})
        }
    </script>
</body>
</html>